package mate.business
{
	import classespinkpony.Country;
	import classespinkpony.District;
	import classespinkpony.Problem;
	import classespinkpony.Profession;
	import classespinkpony.Specialization;
	import classespinkpony.Target;
	
	import mx.collections.ArrayCollection;
	import mx.controls.Alert;

	public class AdvancedSearchManager
	{
		
		private var _countries : ArrayCollection = new ArrayCollection();
		private var _districts : ArrayCollection = new ArrayCollection();
		private var _professions : ArrayCollection = new ArrayCollection();
		private var _specializations : ArrayCollection = new ArrayCollection();
		private var _targets : ArrayCollection = new ArrayCollection();
		private var _problems : ArrayCollection = new ArrayCollection();
		
		public function storeCountries(countries:Object):void{
			var temp: ArrayCollection = new ArrayCollection();
			
			if(countries != null){
				for each (var country: Country in countries){
					temp.addItem(country);
				}
			}
			
			this.countries = temp;
		}
		
		public function storeDistricts(districts:Object):void{
			var temp: ArrayCollection = new ArrayCollection();
			
			if(districts != null){
				for each (var distr: District in districts){
					temp.addItem(distr);
				}
			}
			
			this.districts = temp;
		}
		
		public function storeProfessions(professions:Object):void{
			var temp: ArrayCollection = new ArrayCollection();
			
			if(professions != null){
				for each (var prof: Profession in professions){
					temp.addItem(prof);
				}
			}
			
			this.professions = temp;
		}
		
		public function storeSpecializations(specs:Object):void{
			var temp: ArrayCollection = new ArrayCollection();
			
			if(specs != null){
				for each (var spec: Specialization in specs){
					temp.addItem(spec);
				}
			}
			
			this.specializations = temp;
		}
		
		public function storeTargets(targets:Object):void{
			var temp: ArrayCollection = new ArrayCollection();
			
			if(targets != null){
				for each (var targ: Target in targets){
					temp.addItem(targ);
				}
			}
			
			this.targets = temp;
		}
		
		public function storeProblems(problems:Object):void{
			var temp: ArrayCollection = new ArrayCollection();
			
			if(problems != null){
				for each (var prob: Problem in problems){
					temp.addItem(prob);
				}
			}
			
			this.problems = temp;
		}

		[Bindable]
		public function get countries():ArrayCollection
		{
			return _countries;
		}

		public function set countries(value:ArrayCollection):void
		{
			_countries = value;
		}

		[Bindable]
		public function get districts():ArrayCollection
		{
			return _districts;
		}

		public function set districts(value:ArrayCollection):void
		{
			_districts = value;
		}

		[Bindable]
		public function get professions():ArrayCollection
		{
			return _professions;
		}

		public function set professions(value:ArrayCollection):void
		{
			_professions = value;
		}

		[Bindable]
		public function get specializations():ArrayCollection
		{
			return _specializations;
		}

		public function set specializations(value:ArrayCollection):void
		{
			_specializations = value;
		}

		[Bindable]
		public function get targets():ArrayCollection
		{
			return _targets;
		}

		public function set targets(value:ArrayCollection):void
		{
			_targets = value;
		}

		[Bindable]
		public function get problems():ArrayCollection
		{
			return _problems;
		}

		public function set problems(value:ArrayCollection):void
		{
			_problems = value;
		}
		
		public function debug_alert(message:Object): void{
			for each(var mes : String in message){
				Alert.show(mes.toString());
			}
		}


	}
}